# Makefile for iTextUploader
# Revision: $Id$

CC = arm-apple-darwin9-gcc
LD = $(CC)
LDFLAGS = -lobjc \
	-lcrypto \
	-framework CoreFoundation \
	-framework Foundation \
	-framework UIKit \
	-L"/usr/lib"\
	-F"/System/Library/Frameworks"\
	-F"/System/Library/PrivateFrameworks"\
	-bind_at_load
CFLAGS = -I/var/include

all:	iTextUploader

iTextUploader: iTextUploader.o FileUpload.o PreferencesPanel.o
	$(LD) $(LDFLAGS) -o $@ $^
	ldid -S iTextUploader
	-mkdir iTextUploader.app/
	cp -p iTextUploader ./iTextUploader.app/
	cp -p Info.plist ./iTextUploader.app/
	cp -p icon.png ./iTextUploader.app/
	#cp -p MainText.html ./iTextUploader.app/
	#cp -p About.html ./iTextUploader.app/
	#cp -p Message.html ./iTextUploader.app/
	#cp -p ok.png ./iTextUploader.app/
	#cp -p error.png ./iTextUploader.app/
	#rm -f *.o *.gch iTextUploader

install:
	-rm -rv /Applications/iTextUploader.app
	cp -rv iTextUploader.app/ /Applications/
	-mv /var/mobile/Library/Preferences/com.isms.itextuploader.plist /var/mobile/Library/Preferences/it.youarchive.itextuploader.plist
	cp -i it.youarchive.itextuploader.plist /var/mobile/Library/Preferences/
	chown mobile  /var/mobile/Library/Preferences/it.youarchive.itextuploader.plist
	chmod 0644  /var/mobile/Library/Preferences/it.youarchive.itextuploader.plist

clean:
	rm -f *.o *.gch iTextUploader
	rm -rv iTextUploader.app

%.o:       %.m
	$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@

%.o:       %.c
	$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@

%.o:       %.cpp
	$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@